#coding:utf-8
"""
!/usr/bin/python3
@Author: Gao Shuo
@Time: 2018/8/10 11:20 
@ReadMe:
    Input: 
    Output: 
"""

import glob
import sys
import os
'''
# 制作测试、训练集
# 所有的文件路径
patha = "C:\Users\THINKPAD\Desktop\数据组\技术表现\segnet\water\\train-wtAll.txt"

inf = open(patha.decode('utf-8'),'r')
lines = inf.readlines()
print len(lines)
# 共14479图片， 其中4826做测试
# print lines[0]
pathTest ="C:\Users\THINKPAD\Desktop\数据组\技术表现\segnet\water\\train-wt-test4826.txt"
testf = open(pathTest.decode('utf-8'), 'w')
pathTrain ="C:\Users\THINKPAD\Desktop\数据组\技术表现\segnet\water\\train-wt-train9653.txt"
trainf = open(pathTrain.decode('utf-8'), 'w')
i=0
for line in lines:
    if i<= 4827:
        testf.write(line)
    else:
        trainf.write(line)
    i+=1
testf.close()
trainf.close()
'''
if __name__ == "__main__":
    path = sys.argv[1]
    dest = sys.argv[2]

    for filename in glob.glob(path):
        print filename.decode('gbk')
        file0 = filename.split('\\')[-1]
        print file0
        fileOutput = dest + "\\"+ file0
        print fileOutput

str = 'C:\Users\THINKPAD\Desktop\数据组\项目'

def new_folder (path ):
    """
    如果路径不是-，不存在的话就新建
    """
    if path != '-':
        if not os.path.exists(path):
            os.makedirs(path)
    return path